<?php
/**
 * Global constants and functions
 *
 *
 */
namespace PUF;

/**
 * Transforms a non-array into an array of one element: that object
 * If param is an array it does nothing
 *
 * Params:
 * $futureArray : Mixed. Object to convert
 */
function arrayizeObject(&$futureArray) {
	if (!is_array($futureArray)) {
		$futureArray = array($futureArray);
	}
}

/**
 * Dumps variable and details from where was called
 *
 * Params:
 * $var : Mixed. Variable to dump
 */
function debug($var) {
	$backtrace = debug_backtrace();
	
	echo '<pre>';
	echo '<strong>';
	// Show file and line from caller
	echo $backtrace[0]['file'] . ' (Line ' . $backtrace[0]['line'] . ') => ';
	echo '</strong>';
	
	var_dump($var);
	echo '</pre>';
}